.TH "NETCONF rpc-reply" 3 "Wed Jan 28 2015" "Version 0.9.0-33_trunk" "libnetconf" \" -*- nroff -*-
.ad l
.nh
.SH NAME
NETCONF rpc-reply \- 
.PP
libnetconf's functions for handling NETCONF <rpc-reply> messages\&.  

.SS "Typedefs"

.in +1c
.ti -1c
.RI "typedef struct nc_msg \fBnc_reply\fP"
.br
.RI "\fIreply message\&. \fP"
.in -1c
.SS "Enumerations"

.in +1c
.ti -1c
.RI "enum \fBNC_REPLY_TYPE\fP { \fBNC_REPLY_UNKNOWN\fP, \fBNC_REPLY_HELLO\fP, \fBNC_REPLY_OK\fP, \fBNC_REPLY_ERROR\fP, \fBNC_REPLY_DATA\fP }"
.br
.RI "\fIEnumeration of <rpc-reply> types\&. \fP"
.in -1c
.SS "Functions"

.in +1c
.ti -1c
.RI "void \fBnc_callback_error_reply\fP (void(*func)(const char *tag, const char *type, const char *severity, const char *apptag, const char *path, const char *message, const char *attribute, const char *element, const char *ns, const char *sid))"
.br
.RI "\fISet a callback function to process (e\&.g\&. print) NETCONF <rpc-error> message items\&.
.PP
If the func parameter is NULL, the callback is set back to the default (no) function\&. \fP"
.ti -1c
.RI "\fBnc_reply\fP * \fBnc_reply_build\fP (const char *reply_dump)"
.br
.RI "\fIBuild <rpc-reply> message from the string\&. This is the reverse function of the \fBnc_reply_dump()\fP\&. \fP"
.ti -1c
.RI "\fBnc_reply\fP * \fBnc_reply_data\fP (const char *data)"
.br
.RI "\fICreate rpc-reply response with <data> content (in urn:ietf:params:xml:ns:netconf:base:1\&.0 namespace)\&. \fP"
.ti -1c
.RI "\fBnc_reply\fP * \fBnc_reply_data_ns\fP (const char *data, const char *ns)"
.br
.RI "\fICreate rpc-reply response with <data> content in the specified namespace\&. \fP"
.ti -1c
.RI "char * \fBnc_reply_dump\fP (const \fBnc_reply\fP *reply)"
.br
.RI "\fIDump the rpc-reply message into a string\&. \fP"
.ti -1c
.RI "\fBnc_reply\fP * \fBnc_reply_dup\fP (const \fBnc_reply\fP *reply)"
.br
.RI "\fIDuplicate <reply> message\&. \fP"
.ti -1c
.RI "\fBnc_reply\fP * \fBnc_reply_error\fP (struct nc_err *error)"
.br
.RI "\fICreate rpc-reply response with <rpc-error> content\&. \fP"
.ti -1c
.RI "int \fBnc_reply_error_add\fP (\fBnc_reply\fP *reply, struct nc_err *error)"
.br
.RI "\fIAdd another error description into the existing rpc-reply with <rpc-error> content\&. \fP"
.ti -1c
.RI "void \fBnc_reply_free\fP (\fBnc_reply\fP *reply)"
.br
.RI "\fIFree reply message\&. \fP"
.ti -1c
.RI "char * \fBnc_reply_get_data\fP (const \fBnc_reply\fP *reply)"
.br
.RI "\fIGet content of the <data> element in <rpc-reply>\&. \fP"
.ti -1c
.RI "const char * \fBnc_reply_get_data_ns\fP (const \fBnc_reply\fP *reply)"
.br
.RI "\fIGet namespace of the <data> element in <rpc-reply>\&. \fP"
.ti -1c
.RI "const char * \fBnc_reply_get_errormsg\fP (const \fBnc_reply\fP *reply)"
.br
.RI "\fIGet error-message from the server's <rpc-error> reply\&. \fP"
.ti -1c
.RI "const \fBnc_msgid\fP \fBnc_reply_get_msgid\fP (const \fBnc_reply\fP *reply)"
.br
.RI "\fIGet message-id of the given rpc-reply\&. \fP"
.ti -1c
.RI "\fBNC_REPLY_TYPE\fP \fBnc_reply_get_type\fP (const \fBnc_reply\fP *reply)"
.br
.RI "\fIGet the type of the rpc-reply message\&. \fP"
.ti -1c
.RI "\fBnc_reply\fP * \fBnc_reply_merge\fP (int count,\&.\&.\&.)"
.br
.RI "\fIMerge reply messages\&. All messages MUST be of the same type\&. \fP"
.ti -1c
.RI "\fBnc_reply\fP * \fBnc_reply_ok\fP (void)"
.br
.RI "\fICreate <ok> rpc-reply response\&. \fP"
.ti -1c
.RI "\fBNC_MSG_TYPE\fP \fBnc_session_recv_reply\fP (struct nc_session *session, int timeout, \fBnc_reply\fP **reply)"
.br
.RI "\fIReceive <rpc-reply> response from the specified NETCONF session\&. This function is supposed to be performed only by NETCONF clients\&. \fP"
.ti -1c
.RI "const \fBnc_msgid\fP \fBnc_session_send_reply\fP (struct nc_session *session, const \fBnc_rpc\fP *rpc, const \fBnc_reply\fP *reply)"
.br
.RI "\fISend <rpc-reply> response via specified NETCONF session\&. This function is supposed to be performed only by NETCONF servers\&. \fP"
.in -1c
.SH "Detailed Description"
.PP 
libnetconf's functions for handling NETCONF <rpc-reply> messages\&. 


.SH "Typedef Documentation"
.PP 
.SS "typedef struct nc_msg \fBnc_reply\fP"

.PP
reply message\&. 
.SH "Enumeration Type Documentation"
.PP 
.SS "enum \fBNC_REPLY_TYPE\fP"

.PP
Enumeration of <rpc-reply> types\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fINC_REPLY_UNKNOWN \fP\fP
value describing that no rpc-reply type was detected so far 
.TP
\fB\fINC_REPLY_HELLO \fP\fP
<hello> message type, same as NC_RPC_HELLO 
.TP
\fB\fINC_REPLY_OK \fP\fP
<ok> rpc-reply message type 
.TP
\fB\fINC_REPLY_ERROR \fP\fP
<rpc-error> rpc-reply message type 
.TP
\fB\fINC_REPLY_DATA \fP\fP
rpc-reply message containing <data> 
.SH "Function Documentation"
.PP 
.SS "void nc_callback_error_reply (void(*)(const char *tag, const char *type, const char *severity, const char *apptag, const char *path, const char *message, const char *attribute, const char *element, const char *ns, const char *sid)func)"

.PP
Set a callback function to process (e\&.g\&. print) NETCONF <rpc-error> message items\&.
.PP
If the func parameter is NULL, the callback is set back to the default (no) function\&. 
.PP
\fBParameters:\fP
.RS 4
\fIfunc\fP Callback function to use\&. Passed parameters are:
.IP "\(bu" 2
tag - error tag,
.IP "\(bu" 2
type - error layer where the error occurred,
.IP "\(bu" 2
severity - error severity,
.IP "\(bu" 2
apptag - the data-model-specific or implementation-specific error condition, if one exists,
.IP "\(bu" 2
path - XPATH expression identifying element with the error,
.IP "\(bu" 2
message - human-readable description of the error,
.IP "\(bu" 2
attribute - name of the data-model-specific XML attribute that caused the error,
.IP "\(bu" 2
element - name of the data-model-specific XML element that caused the error,
.IP "\(bu" 2
ns - name of the unexpected XML namespace that caused the error,
.IP "\(bu" 2
sid - session ID of the session holding the requested lock\&. 
.PP
.RE
.PP

.SS "\fBnc_reply\fP* nc_reply_build (const char *reply_dump)"

.PP
Build <rpc-reply> message from the string\&. This is the reverse function of the \fBnc_reply_dump()\fP\&. 
.PP
\fBParameters:\fP
.RS 4
\fIreply_dump\fP String containing the NETCONF <rpc-reply> message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Complete reply structure used by libnetconf's functions\&. 
.RE
.PP

.SS "\fBnc_reply\fP* nc_reply_data (const char *data)"

.PP
Create rpc-reply response with <data> content (in urn:ietf:params:xml:ns:netconf:base:1\&.0 namespace)\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP Serialized XML content of the <data> element for the <rpc-reply> message being created\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created <rpc-reply> message\&. 
.RE
.PP

.SS "\fBnc_reply\fP* nc_reply_data_ns (const char *data, const char *ns)"

.PP
Create rpc-reply response with <data> content in the specified namespace\&. 
.PP
\fBParameters:\fP
.RS 4
\fIdata\fP Serialized XML content of the <data> element for the <rpc-reply> message being created\&. 
.br
\fIns\fP Default namespace for the data element\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created <rpc-reply> message\&. 
.RE
.PP

.SS "char* nc_reply_dump (const \fBnc_reply\fP *reply)"

.PP
Dump the rpc-reply message into a string\&. 
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP rpc-reply message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
String in XML format containing the NETCONF's <rpc-reply> element and all of its content\&. Caller is responsible for freeing the returned string with free()\&. 
.RE
.PP

.SS "\fBnc_reply\fP* nc_reply_dup (const \fBnc_reply\fP *reply)"

.PP
Duplicate <reply> message\&. 
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP <reply> message to replicate\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Copy of the given <reply> message\&. 
.RE
.PP

.SS "\fBnc_reply\fP* nc_reply_error (struct nc_err *error)"

.PP
Create rpc-reply response with <rpc-error> content\&. 
.PP
\fBParameters:\fP
.RS 4
\fIerror\fP NETCONF error description structure for the reply message\&. From now, the error is connected with the reply and should not be used by the caller\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Created <rpc-reply> message\&. 
.RE
.PP

.SS "int nc_reply_error_add (\fBnc_reply\fP *reply, struct nc_err *error)"

.PP
Add another error description into the existing rpc-reply with <rpc-error> content\&. This function can be applied only to reply messages created by \fBnc_reply_error()\fP\&.
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP Reply structure to which the given error description will be added\&. 
.br
\fIerror\fP NETCONF error description structure for the reply message\&. From now, the error is connected with the reply and should not be used by the caller\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, non-zero else\&. 
.RE
.PP

.SS "void nc_reply_free (\fBnc_reply\fP *reply)"

.PP
Free reply message\&. 
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP reply message to free\&. 
.RE
.PP

.SS "char* nc_reply_get_data (const \fBnc_reply\fP *reply)"

.PP
Get content of the <data> element in <rpc-reply>\&. 
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP rpc-reply message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
String with the content of the <data> element\&. Caller is responsible for freeing the returned string with free()\&. 
.RE
.PP

.SS "const char* nc_reply_get_data_ns (const \fBnc_reply\fP *reply)"

.PP
Get namespace of the <data> element in <rpc-reply>\&. 
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP rpc-reply message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
Namespace of the <data> element\&. Do not free\&. 
.RE
.PP

.SS "const char* nc_reply_get_errormsg (const \fBnc_reply\fP *reply)"

.PP
Get error-message from the server's <rpc-error> reply\&. 
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP rpc-reply message of the \fBNC_REPLY_ERROR\fP type\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
String with the content of the <error-message> element\&. Referenced string is a part of the reply, so it can not be used after freeing the given reply\&. 
.RE
.PP

.SS "const \fBnc_msgid\fP nc_reply_get_msgid (const \fBnc_reply\fP *reply)"

.PP
Get message-id of the given rpc-reply\&. 
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP rpc-reply message\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
message-id of the given rpc-reply message\&. 
.RE
.PP

.SS "\fBNC_REPLY_TYPE\fP nc_reply_get_type (const \fBnc_reply\fP *reply)"

.PP
Get the type of the rpc-reply message\&. <rpc-reply> message can contain <ok>, <rpc-error> or <data>
.PP
\fBParameters:\fP
.RS 4
\fIreply\fP rpc-reply message 
.RE
.PP
\fBReturns:\fP
.RS 4
One of the \fBNC_REPLY_TYPE\fP\&. 
.RE
.PP

.SS "\fBnc_reply\fP* nc_reply_merge (intcount, \&.\&.\&.)"

.PP
Merge reply messages\&. All messages MUST be of the same type\&. Function merges a number of <rpc-reply> specified by the count parameter (at least 2) into one <rpc-reply> message which is returned as the result\&. When the merge is successful, all input messages are freed and MUST NOT be used after this call\&. Merge can fail only because of an invalid input parameter\&. In such a case, NULL is returned and input messages are left unchanged\&.
.PP
\fBParameters:\fP
.RS 4
\fIcount\fP Number of messages to merge 
.br
\fI\&.\&.\&.\fP Messages to merge (all are of nc_reply* type)\&. Total number of messages MUST be equal to count\&.
.RE
.PP
\fBReturns:\fP
.RS 4
Pointer to a new reply message with the merged content of the messages to merge\&. If an error occurs (due to the invalid input parameters), NULL is returned and the messages to merge are not freed\&. 
.RE
.PP

.SS "\fBnc_reply\fP* nc_reply_ok (void)"

.PP
Create <ok> rpc-reply response\&. 
.PP
\fBReturns:\fP
.RS 4
Created <rpc-reply> message\&. 
.RE
.PP

.SS "\fBNC_MSG_TYPE\fP nc_session_recv_reply (struct nc_session *session, inttimeout, \fBnc_reply\fP **reply)"

.PP
Receive <rpc-reply> response from the specified NETCONF session\&. This function is supposed to be performed only by NETCONF clients\&. 
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP NETCONF session to use\&. 
.br
\fItimeout\fP Timeout in milliseconds, -1 for infinite timeout, 0 for non-blocking 
.br
\fIreply\fP Received <rpc-reply> 
.RE
.PP
\fBReturns:\fP
.RS 4
.IP "\(bu" 2
\fBNC_MSG_REPLY\fP - success, *reply points to the received <rpc-reply> message\&.
.IP "\(bu" 2
\fBNC_MSG_HELLO\fP - success, *reply points to the received <hello> message\&.
.IP "\(bu" 2
\fBNC_MSG_NONE\fP - success, but <rpc-reply> with error information was processed automatically using callback specified with \fBnc_callback_error_reply()\fP function\&. *reply was not changed\&.
.IP "\(bu" 2
\fBNC_MSG_UNKNOWN\fP - error occurred
.IP "\(bu" 2
\fBNC_MSG_NOTIFICATION\fP - <notification> message was received and enqueued to the internal queue until the \fBnc_session_recv_notif()\fP function is called\&. Caller is supposed to repeat the function call to receive another <rpc-reply> message\&.
.IP "\(bu" 2
\fBNC_MSG_WOULDBLOCK\fP - receiving timeouted without any received message\&. 
.PP
.RE
.PP

.SS "const \fBnc_msgid\fP nc_session_send_reply (struct nc_session *session, const \fBnc_rpc\fP *rpc, const \fBnc_reply\fP *reply)"

.PP
Send <rpc-reply> response via specified NETCONF session\&. This function is supposed to be performed only by NETCONF servers\&. This function IS thread safe\&.
.PP
\fBParameters:\fP
.RS 4
\fIsession\fP NETCONF session to use\&. 
.br
\fIrpc\fP <rpc> message which is request for the sending reply 
.br
\fIreply\fP <repc-reply> message to send\&. 
.RE
.PP
\fBReturns:\fP
.RS 4
0 on error,
.br
 message-id of sent message on success\&. 
.RE
.PP

.SH "Author"
.PP 
Generated automatically by Doxygen for libnetconf from the source code\&.
